﻿/*
   绑定视图：UserViewDialog.xaml
   文件说明：控制用户管理 (新增/编辑)业务层
*/
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZFSData;
using ZFSDomain.Interface.Base;
using ZFSDomain.SysModule;

namespace ZFSDomain.ViewModel.User
{
    /// <summary>
    /// 用户编辑
    /// </summary>
    public class UserDialogViewModel : BaseDialogOperation
    {
        public UserDialogViewModel()
        {
            User = new tb_User();
        }

        private tb_User user;

        /// <summary>
        /// 编辑用户
        /// </summary>
        public tb_User User
        {
            get { return user; }
            set { user = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 保存
        /// </summary>
        public override void Save()
        {
            if (User.Account == null)
            {
                return;
            }

            if (User.UserName == null)
            {
                return;
            }
            this.Result = true;
            Messenger.Default.Send("", "CloseWindow");

        }

        /// <summary>
        /// 取消
        /// </summary>
        public override void Cancel()
        {
            this.Result = false;
            Messenger.Default.Send("", "CloseWindow");
        }

    }
}
